+Sat Sep 5 16:01:19 1998 Owen Taylor <otaylor@gtk.org>
+
+ * gdk/gdkinputxfree.h gdk/gdk.c gdk/gdkinputgxi.h:
+ When the pointer is grabbed on an input window,
+ either explicitely, or through press-grab, and
+ then grabbed on a non-input window, ungrab the
+ devices.
+
Sat Sep 5 07:13:19 1998 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.h: don't include any gdk headers.
+Sat Sep 5 16:01:19 1998 Owen Taylor <otaylor@gtk.org>
+
+ * gdk/gdkinputxfree.h gdk/gdk.c gdk/gdkinputgxi.h:
+ When the pointer is grabbed on an input window,
+ either explicitely, or through press-grab, and
+ then grabbed on a non-input window, ungrab the
+ devices.
+
Sat Sep 5 07:13:19 1998 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.h: don't include any gdk headers.
+Sat Sep 5 16:01:19 1998 Owen Taylor <otaylor@gtk.org>
+
+ * gdk/gdkinputxfree.h gdk/gdk.c gdk/gdkinputgxi.h:
+ When the pointer is grabbed on an input window,
+ either explicitely, or through press-grab, and
+ then grabbed on a non-input window, ungrab the
+ devices.
+
Sat Sep 5 07:13:19 1998 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.h: don't include any gdk headers.
+Sat Sep 5 16:01:19 1998 Owen Taylor <otaylor@gtk.org>
+
+ * gdk/gdkinputxfree.h gdk/gdk.c gdk/gdkinputgxi.h:
+ When the pointer is grabbed on an input window,
+ either explicitely, or through press-grab, and
+ then grabbed on a non-input window, ungrab the
+ devices.
+
Sat Sep 5 07:13:19 1998 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.h: don't include any gdk headers.
+Sat Sep 5 16:01:19 1998 Owen Taylor <otaylor@gtk.org>
+
+ * gdk/gdkinputxfree.h gdk/gdk.c gdk/gdkinputgxi.h:
+ When the pointer is grabbed on an input window,
+ either explicitely, or through press-grab, and
+ then grabbed on a non-input window, ungrab the
+ devices.
+
Sat Sep 5 07:13:19 1998 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.h: don't include any gdk headers.
+Sat Sep 5 16:01:19 1998 Owen Taylor <otaylor@gtk.org>
+
+ * gdk/gdkinputxfree.h gdk/gdk.c gdk/gdkinputgxi.h:
+ When the pointer is grabbed on an input window,
+ either explicitely, or through press-grab, and
+ then grabbed on a non-input window, ungrab the
+ devices.
+
Sat Sep 5 07:13:19 1998 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.h: don't include any gdk headers.
+Sat Sep 5 16:01:19 1998 Owen Taylor <otaylor@gtk.org>
+
+ * gdk/gdkinputxfree.h gdk/gdk.c gdk/gdkinputgxi.h:
+ When the pointer is grabbed on an input window,
+ either explicitely, or through press-grab, and
+ then grabbed on a non-input window, ungrab the
+ devices.
+
Sat Sep 5 07:13:19 1998 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.h: don't include any gdk headers.
xevent_mask |= event_mask_table[i];
}
- if (((GdkWindowPrivate *)window)->extension_events &&
- gdk_input_vtable.grab_pointer)
+ if (gdk_input_vtable.grab_pointer)
return_val = gdk_input_vtable.grab_pointer (window,
owner_events,
event_mask,
{
GdkInputWindow *input_window, *new_window;
GList *tmp_list;
+ GdkDevicePrivate *gdkdev;
+ GList *tmp_list;
tmp_list = gdk_input_windows;
while (tmp_list)
{
input_window = (GdkInputWindow *)tmp_list->data;
- if (input_window->grabbed)
- return AlreadyGrabbed;
if (input_window->window == window)
new_window = input_window;
+ else (input_window->grabbed)
+ input_window->grabbed = FALSE;
+
+ tmp_list = gdk_input_devices;
+ while (tmp_list)
+ {
+ gdkdev = (GdkDevicePrivate *)tmp_list->data;
+ if (gdkdev->info.deviceid != GDK_CORE_POINTER &&
+ gdkdev->xdevice &&
+ (gdkdev->button_state != 0))
+ gdkdev->button_state = 0;
+
+ tmp_list = tmp_list->next;
+ }
+
tmp_list = tmp_list->next;
}
guint32 time)
{
GdkInputWindow *input_window, *new_window;
+ gboolean need_ungrab;
GdkDevicePrivate *gdkdev;
GList *tmp_list;
XEventClass event_classes[GDK_MAX_DEVICE_CLASSES];
tmp_list = gdk_input_windows;
new_window = NULL;
+ need_ungrab = FALSE;
+
while (tmp_list)
{
input_window = (GdkInputWindow *)tmp_list->data;
- if (input_window->grabbed)
- return AlreadyGrabbed;
if (input_window->window == window)
new_window = input_window;
-
+ else if (input_window->grabbed)
+ {
+ input_window->grabbed = FALSE;
+ need_ungrab = TRUE;
+ }
+
tmp_list = tmp_list->next;
}
-
- g_return_val_if_fail (new_window != NULL, Success); /* shouldn't happen */
-
- new_window->grabbed = TRUE;
- tmp_list = gdk_input_devices;
- while (tmp_list)
+ if (new_window)
{
- gdkdev = (GdkDevicePrivate *)tmp_list->data;
- if (gdkdev->info.deviceid != GDK_CORE_POINTER &&
- gdkdev->xdevice)
+ new_window->grabbed = TRUE;
+
+ tmp_list = gdk_input_devices;
+ while (tmp_list)
+ {
+ gdkdev = (GdkDevicePrivate *)tmp_list->data;
+ if (gdkdev->info.deviceid != GDK_CORE_POINTER &&
+ gdkdev->xdevice)
+ {
+ gdk_input_common_find_events (window, gdkdev,
+ event_mask,
+ event_classes, &num_classes);
+
+ result = XGrabDevice( GDK_DISPLAY(), gdkdev->xdevice,
+ GDK_WINDOW_XWINDOW (window),
+ owner_events, num_classes, event_classes,
+ GrabModeAsync, GrabModeAsync, time);
+
+ /* FIXME: if failure occurs on something other than the first
+ device, things will be badly inconsistent */
+ if (result != Success)
+ return result;
+ }
+ tmp_list = tmp_list->next;
+ }
+ }
+ else
+ {
+ tmp_list = gdk_input_devices;
+ while (tmp_list)
{
- gdk_input_common_find_events (window, gdkdev,
- event_mask,
- event_classes, &num_classes);
-
- result = XGrabDevice( GDK_DISPLAY(), gdkdev->xdevice,
- GDK_WINDOW_XWINDOW (window),
- owner_events, num_classes, event_classes,
- GrabModeAsync, GrabModeAsync, time);
-
- /* FIXME: if failure occurs on something other than the first
- device, things will be badly inconsistent */
- if (result != Success)
- return result;
+ gdkdev = (GdkDevicePrivate *)tmp_list->data;
+ if (gdkdev->info.deviceid != GDK_CORE_POINTER && gdkdev->xdevice &&
+ ((gdkdev->button_state != 0) || need_ungrab))
+ {
+ XUngrabDevice( gdk_display, gdkdev->xdevice, time);
+ gdkdev->button_state = 0;
+ }
+
+ tmp_list = tmp_list->next;
}
- tmp_list = tmp_list->next;
}
-
+
return Success;
+
}
static void
{
GdkInputWindow *input_window, *new_window;
GList *tmp_list;
+ GdkDevicePrivate *gdkdev;
+ GList *tmp_list;
tmp_list = gdk_input_windows;
while (tmp_list)
{
input_window = (GdkInputWindow *)tmp_list->data;
- if (input_window->grabbed)
- return AlreadyGrabbed;
if (input_window->window == window)
new_window = input_window;
+ else (input_window->grabbed)
+ input_window->grabbed = FALSE;
+
+ tmp_list = gdk_input_devices;
+ while (tmp_list)
+ {
+ gdkdev = (GdkDevicePrivate *)tmp_list->data;
+ if (gdkdev->info.deviceid != GDK_CORE_POINTER &&
+ gdkdev->xdevice &&
+ (gdkdev->button_state != 0))
+ gdkdev->button_state = 0;
+
+ tmp_list = tmp_list->next;
+ }
+
tmp_list = tmp_list->next;
}
guint32 time)
{
GdkInputWindow *input_window, *new_window;
+ gboolean need_ungrab;
GdkDevicePrivate *gdkdev;
GList *tmp_list;
XEventClass event_classes[GDK_MAX_DEVICE_CLASSES];
tmp_list = gdk_input_windows;
new_window = NULL;
+ need_ungrab = FALSE;
+
while (tmp_list)
{
input_window = (GdkInputWindow *)tmp_list->data;
- if (input_window->grabbed)
- return AlreadyGrabbed;
if (input_window->window == window)
new_window = input_window;
-
+ else if (input_window->grabbed)
+ {
+ input_window->grabbed = FALSE;
+ need_ungrab = TRUE;
+ }
+
tmp_list = tmp_list->next;
}
-
- g_return_val_if_fail (new_window != NULL, Success); /* shouldn't happen */
-
- new_window->grabbed = TRUE;
- tmp_list = gdk_input_devices;
- while (tmp_list)
+ if (new_window)
{
- gdkdev = (GdkDevicePrivate *)tmp_list->data;
- if (gdkdev->info.deviceid != GDK_CORE_POINTER &&
- gdkdev->xdevice)
+ new_window->grabbed = TRUE;
+
+ tmp_list = gdk_input_devices;
+ while (tmp_list)
+ {
+ gdkdev = (GdkDevicePrivate *)tmp_list->data;
+ if (gdkdev->info.deviceid != GDK_CORE_POINTER &&
+ gdkdev->xdevice)
+ {
+ gdk_input_common_find_events (window, gdkdev,
+ event_mask,
+ event_classes, &num_classes);
+
+ result = XGrabDevice( GDK_DISPLAY(), gdkdev->xdevice,
+ GDK_WINDOW_XWINDOW (window),
+ owner_events, num_classes, event_classes,
+ GrabModeAsync, GrabModeAsync, time);
+
+ /* FIXME: if failure occurs on something other than the first
+ device, things will be badly inconsistent */
+ if (result != Success)
+ return result;
+ }
+ tmp_list = tmp_list->next;
+ }
+ }
+ else
+ {
+ tmp_list = gdk_input_devices;
+ while (tmp_list)
{
- gdk_input_common_find_events (window, gdkdev,
- event_mask,
- event_classes, &num_classes);
-
- result = XGrabDevice( GDK_DISPLAY(), gdkdev->xdevice,
- GDK_WINDOW_XWINDOW (window),
- owner_events, num_classes, event_classes,
- GrabModeAsync, GrabModeAsync, time);
-
- /* FIXME: if failure occurs on something other than the first
- device, things will be badly inconsistent */
- if (result != Success)
- return result;
+ gdkdev = (GdkDevicePrivate *)tmp_list->data;
+ if (gdkdev->info.deviceid != GDK_CORE_POINTER && gdkdev->xdevice &&
+ ((gdkdev->button_state != 0) || need_ungrab))
+ {
+ XUngrabDevice( gdk_display, gdkdev->xdevice, time);
+ gdkdev->button_state = 0;
+ }
+
+ tmp_list = tmp_list->next;
}
- tmp_list = tmp_list->next;
}
-
+
return Success;
+
}
static void
xevent_mask |= event_mask_table[i];
}
- if (((GdkWindowPrivate *)window)->extension_events &&
- gdk_input_vtable.grab_pointer)
+ if (gdk_input_vtable.grab_pointer)
return_val = gdk_input_vtable.grab_pointer (window,
owner_events,
event_mask,